package com.agrishare.service;

import com.agrishare.entity.User;
import com.agrishare.entity.UserRole;
import com.agrishare.entity.UserStatus;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Optional;

public interface UserService {
    
    User register(User user);
    
    User createUser(User user);
    
    Optional<User> login(String username, String password);
    
    User updateProfile(Long userId, User userInfo);
    
    User changePassword(Long userId, String oldPassword, String newPassword);
    
    void resetPassword(String email);
    
    Optional<User> findById(Long id);
    
    Optional<User> findByUsername(String username);
    
    Optional<User> findByEmail(String email);
    
    Page<User> findAll(Pageable pageable);
    
    Page<User> searchUsers(String keyword, Pageable pageable);
    
    List<User> getTopUsers(int limit);
    
    User updateUserStatus(Long userId, UserStatus status);
    
    User updateUserRole(Long userId, UserRole role);
    
    void updateUserLevel(Long userId);
    
    void updateLastLogin(Long userId);
    
    boolean existsByUsername(String username);
    
    boolean existsByEmail(String email);
    
    void addPoints(Long userId, int points);
}